//package strategy;
//
//import cn.hutool.core.thread.ThreadFactoryBuilder;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.concurrent.*;
//
///**
// * @ClassName : TestThreadFactoryFuture
// * @Description :
// * @Author : gyh
// * @Date: 2022-01-07 22:26
// */
//public class TestThreadFactoryFuture {
////    ExecutorService executor = new ThreadPoolExecutor(size, 10, 0L, TimeUnit.MILLISECONDS,
////            new LinkedBlockingQueue<Runnable>(), namedThreadFactory);
//
//
//    public static void main(String[] args) {
//        ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNamePrefix("jd-call").build();
//        ThreadPoolExecutor executor = new ThreadPoolExecutor(5, 10, 0L,
//                TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), namedThreadFactory);
//        List<String> stringList = new ArrayList<>();
//        for (int i = 0; i < 1000; i++) {
//            int j = i;
//            CompletableFuture<List<String>> future = CompletableFuture.supplyAsync(() -> {
//                List<String> list = getList(j);
//
//                System.out.println("线程池中线程数目：" + executor.getPoolSize() + "，队列中等待执行的任务数目：" +
//                        executor.getQueue().size() + "，已执行玩别的任务数目：" + executor.getCompletedTaskCount());
//                return getList(j);
//            }, executor);
//
//
//        }
//    }
//
//    private static List<String> getList(int j) {
//        System.out.println(Thread.currentThread().getName() + "正在执行task " + j);
//        try {
//            Thread.currentThread().sleep(1000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
//        System.out.println("task " + j + "执行完毕");
//    }
//}
//
////class MyTask implements Runnable {
////    private int taskNum;
////
////    public MyTask(int num) {
////        this.taskNum = num;
////    }
////
////    @Override
////    public void run() {
////        System.out.println(Thread.currentThread().getName() + "正在执行task " + taskNum);
////        try {
////            Thread.currentThread().sleep(1000);
////        } catch (InterruptedException e) {
////            e.printStackTrace();
////        }
////        System.out.println("task " + taskNum + "执行完毕");
////    }
////}